#ifndef TCPCONNECTIONPOOL_H
#define TCPCONNECTIONPOOL_H

#include "core_global.h"
#include <boost/noncopyable.hpp>
#include <boost/asio/io_service.hpp>
#include <boost/pool/object_pool.hpp>

class TcpConnection;

class CORE_HIDDEN TcpConnectionPool
{
public:
    typedef boost::asio::io_service Service;

    typedef boost::object_pool< TcpConnection > ConnectionPool;
    typedef boost::shared_ptr< TcpConnection > ConnectionPtr;

public:
    TcpConnectionPool();
    ~TcpConnectionPool();

    ConnectionPtr alloc(Service &service);

protected:
    void destroy(TcpConnection *p);

private:
    ConnectionPool m_pool;
};

#endif // TCPCONNECTIONPOOL_H
